﻿
(function ($) {
    app.modals.CreateOrEditProductModeModal = function () {

        var _modalManager;

        var _productModeService = abp.services.app.productMode;

		//$(".maxlength-handler").maxlength({
  //          limitReachedClass: "label label-danger",
  //          alwaysShow: true,
  //          threshold: 5,
  //          placement: 'bottom'
  //      });

        var _$productModeInformationForm = null;


        this.init = function (modalManager) {
            _modalManager = modalManager;
			            _$productModeInformationForm = _modalManager.getModal().find("form[name=productModeInformationsForm]");

						
			 
			   	 


						
			 
			   	 


						
			 
			   	 


						
			 
			   	 


			
			
      


        }
        
        this.save = function () {
            if (!_$productModeInformationForm.valid()) {
                return;
            }
            //校验通过

            var productMode = _$productModeInformationForm.serializeFormToObject();
          //  console.log(productMode);

            _modalManager.setBusy(true);

            _productModeService.createOrUpdateProductModeAsync({
                productModeEditDto: productMode
            }).done(function () {
                //提示信息
                abp.notify.info(app.localize('SavedSuccessfully'));
                //关闭窗体
                _modalManager.close();
                //信息保存成功后调用事件，刷新列表
                abp.event.trigger('app.createOrEditProductModeModalSaved');
            }).always(function () {
                _modalManager.setBusy(false);
            });
        }
    }
})(jQuery);

   